package com.home.demo.service.impl;

import com.home.demo.entity.UserEntity;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.home.demo.common.utils.PageUtils;
import com.home.demo.common.utils.Query;

import com.home.demo.dao.BeOnDutyDao;
import com.home.demo.entity.BeOnDutyEntity;
import com.home.demo.service.BeOnDutyService;


@Service("beOnDutyService")
public class BeOnDutyServiceImpl extends ServiceImpl<BeOnDutyDao, BeOnDutyEntity> implements BeOnDutyService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BeOnDutyEntity> page = this.page(
                new Query<BeOnDutyEntity>().getPage(params),
                new QueryWrapper<BeOnDutyEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public String listInfo(String time, String flag) {
        BeOnDutyEntity entity = this.getOne(new QueryWrapper<BeOnDutyEntity>().eq("time",time));
        if (entity!=null) {
            return "zaoBan".equals(flag) ? entity.getZaoBan() : "zhongBan".equals(flag) ? entity.getZhongBan() : entity.getWanBan();
        }
       return null;


    }

}